<template>
  <view class="test-container">
    <view class="test-title">Webview 测试页面</view>
    
    <view class="test-buttons">
      <button class="test-btn" @click="testWebview('https://www.baidu.com', '百度')">
        测试百度
      </button>
      
      <button class="test-btn" @click="testWebview('https://www.qq.com', '腾讯网')">
        测试腾讯网
      </button>
      
      <button class="test-btn" @click="testWebview('https://www.163.com', '网易')">
        测试网易
      </button>
      
      <button class="test-btn" @click="testWebview('https://www.sina.com.cn', '新浪')">
        测试新浪
      </button>
    </view>
    
    <view class="test-info">
      <text class="info-text">点击按钮测试webview页面跳转</text>
      <text class="info-text">支持H5、微信小程序、APP环境</text>
    </view>
  </view>
</template>

<script>
export default {
  name: 'WebviewTest',
  methods: {
    testWebview(url, title) {
      uni.navigateTo({
        url: `/pages/webview/webview?url=${encodeURIComponent(url)}&title=${encodeURIComponent(title)}`
      });
    }
  }
}
</script>

<style lang="less" scoped>
.test-container {
  padding: 40rpx;
  background: #f5f5f5;
  min-height: 100vh;
}

.test-title {
  font-size: 36rpx;
  font-weight: bold;
  color: #333;
  text-align: center;
  margin-bottom: 60rpx;
}

.test-buttons {
  display: flex;
  flex-direction: column;
  gap: 30rpx;
  margin-bottom: 60rpx;
}

.test-btn {
  background: #C6282B;
  color: #ffffff;
  border: none;
  border-radius: 12rpx;
  padding: 30rpx;
  font-size: 32rpx;
  font-weight: 500;
  
  &:active {
    background: #B71C1C;
    transform: scale(0.98);
  }
}

.test-info {
  background: #ffffff;
  padding: 40rpx;
  border-radius: 12rpx;
  box-shadow: 0 4rpx 16rpx rgba(0,0,0,0.1);
}

.info-text {
  display: block;
  font-size: 28rpx;
  color: #666;
  line-height: 1.6;
  margin-bottom: 20rpx;
  
  &:last-child {
    margin-bottom: 0;
  }
}
</style> 